package cn.kgc.controller;


import cn.kgc.dto.ClassifyDto;
import cn.kgc.service.ClassifyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 商品分类 前端控制器
 * </p>
 *
 * @author qf
 * @since 2022-03-03
 */
@RestController
@RequestMapping("/api/home")
public class ClassifyController {

    private final ClassifyService   classifyService;

    public ClassifyController(ClassifyService classifyService) {
        this.classifyService = classifyService;
    }

    @GetMapping("/classifyTree")
     public Map<String,Object> findAll(){
        Map<String,Object> map=new HashMap<>();
        List<ClassifyDto> all = classifyService.findAll();
        map.put("code",0);
        map.put("data",all);
        return map;
    }

}

